<script type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>


<script type="text/javascript">

tinyMCE.init({

// General options
elements : "mailbox_body",
mode : "textareas",
theme : "advanced",
plugins : "imagemanager,emotions",


// Theme options
relative_urls : false,
theme_advanced_buttons1 : "bold,italic,underline",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_resizing : true,
theme_advanced_statusbar_location : "bottom"

	
});

function insertImage(name) {


	//tinyMCEPopup.restoreSelection();
	//document.form_new.body.focus();
	//document.all['body'].focus();
    //ed.dom.focus();

	//var inst = tinyMCE.getInstanceById('body');
	//inst.getFocusElement();
	tinyMCE.getInstanceById('mailbox[body]').getWin().focus();
	tinyMCE.themes['advanced']._insertImage(name);
	//tinyMCEPopup.close();
	
}



</script>		

<div class="title"><?php echo __('Отправка сообщения') ?> to <?php echo link_to($to_user,'profile/show?id='.$to_user->getId()) ?></div>

<div class="form_style">
<form action="<?php echo url_for('@mailbox_send') ?>" method="POST" enctype="multipart/form-data">
<table width="100%">
<?php echo $form ?>
<tr>
<th><?php echo __('Смайлики')?></th>
<td >
<?php echo image_tag('/images/smile/s1.gif',array('onclick'=>'insertImage("'.sfConfig::get('app_smile_dir').'s1.gif")'))?>
<?php echo image_tag('/images/smile/s2.gif',array('onclick'=>'insertImage("'.sfConfig::get('app_smile_dir').'s2.gif")'))?>
<?php echo image_tag('/images/smile/s3.gif',array('onclick'=>'insertImage("'.sfConfig::get('app_smile_dir').'s3.gif")'))?>
<?php echo image_tag('/images/smile/s4.gif',array('onclick'=>'insertImage("'.sfConfig::get('app_smile_dir').'s4.gif")'))?>
<?php echo image_tag('/images/smile/s5.gif',array('onclick'=>'insertImage("'.sfConfig::get('app_smile_dir').'s5.gif")'))?>
<?php echo image_tag('/images/smile/s6.gif',array('onclick'=>'insertImage("'.sfConfig::get('app_smile_dir').'s6.gif")'))?>
<?php echo image_tag('/images/smile/s7.gif',array('onclick'=>'insertImage("'.sfConfig::get('app_smile_dir').'s7.gif")'))?>
<?php echo image_tag('/images/smile/s8.gif',array('onclick'=>'insertImage("'.sfConfig::get('app_smile_dir').'s8.gif")'))?>
<?php echo image_tag('/images/smile/s9.gif',array('onclick'=>'insertImage("'.sfConfig::get('app_smile_dir').'s9.gif")'))?>
<?php echo image_tag('/images/smile/s10.gif',array('onclick'=>'insertImage("'.sfConfig::get('app_smile_dir').'s10.gif")'))?>
</td>
</tr>

<tr>
<td colspan="2" align="center"> 
<input type="submit"  value="<?php echo __('Отправить') ?>" />
</td>
</tr>
</table> 
</form>
</div>



